<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<link  rel="stylesheet" type="text/css" th:href="@{/css/bootstrap.min.css}"/>
<head lang="en">
    <title>View all users</title>
</head>
<body>
<div class="container">
    <div th:replace="fragments :: navbar"></div>
    <div class="float-right mt-2">
        <a class="btn btn-primary btn-sm" th:href="@{/user/form}">Create user</a>
    </div>
    <h4 class="float-left mt-2">Users List</h4>
    <table class="table table-bordered table-striped">
        <thead>
        <tr>
            <th>ID</th>
            <th>Username</th>
            <th>Password</th>
            <th>Mobile</th>
            <th>Role</th>
        </tr>
        </thead>
        <tbody>
        <tr th:if="${users.empty}">
            <td colspan="5">No Users</td>
        </tr>
        <tr th:each="user : ${users}">
            <td th:text="${user.id}"></td>
            <td th:text="${user.username}"></td>
            <td th:text="${user.password}"></td>
            <td th:text="${user.mobile}"></td>
            <td>
                <span th:each="role : ${user.roles}" th:text="${role}+', '"></span>
            </td>
        </tr>
        </tbody>
    </table>
</div>
</body>
</html>